<%@ page import="cn.labbook.bluetooth.constant.UserConstant" %>
<%@ page import="cn.labbook.bluetooth.constant.AdminConstant" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <%
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    %>
    <base href="<%=basePath%>">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="stylesheet" type="text/css" href="assets/css/admin/reset.css"/>
    <link rel="stylesheet" type="text/css" href="assets/plugins/layui/css/layui.css">
    <link rel="stylesheet" type="text/css" href="//at.alicdn.com/t/font_893379_qj8lfap4ylj.css"/>
</head>
<style>
    /*让徽章上下居中*/
    .layui-badge {
        top: 50%;
        transform: translateY(-50%);
    }
</style>
<body>
<div>
    <div class=" clearfix margin-15">
        <div class="layui-col-md12">
            <div class="layui-card-header">
                房东列表
            </div>
            <div class="layui-form layuiadmin-card-header-auto padding-tb-10 layui-card"
                 lay-filter="layadmin-userfront-formlist" id="searchForm">
                <div class="layui-form-item searchDiv" style="margin-bottom: 0">
                    <div class="layui-inline">
                        <label class="layui-form-label" style="text-align: left">房东名称</label>
                        <div class="layui-input-block">
                            <input type="text" placeholder="请输入房东名称" autocomplete="off"
                                   class="layui-input" id="adminName">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn layuiadmin-btn-useradmin" id="search"
                                lay-filter="LAY-user-front-search">
                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                        </button>
                    </div>
                </div>
            </div>
            <div class="layui-tab-content">
                <table class="layui-table" id="payPmList" lay-filter="payPmList"></table>
            </div>
        </div>
    </div>
</div>
<script type="text/html" id="barDemo">
    <a class="btn-white btn-success layui-btn-xs" lay-event="msg">详情信息</a>
</script>
</body>
<script src="assets/plugins/Jquery/jquery.min.js"></script>
<script src="assets/plugins/layui/layui.all.js"></script>
<script src="assets/js/common.js"></script>
<script>
    $(function () {
        layui.use(['table', 'form', 'laydate'], function () {
            var table = layui.table,
                form = layui.form;
            var data = [
                {type: 'numbers', title: '序号'},
                {field: 'adminName', title: '房东姓名', sort: false, align: 'center'},
                {
                    field: 'sex', title: '性别', sort: false, align: 'center', templet: function (d) {
                        if (d.sex == 1) return '<span class="layui-badge layui-bg-blue">男</span>'
                        else if (d.sex == 0) return '<span class="layui-badge layui-bg-red">女</span>'
                        else return '<span class="layui-badge layui-bg-cyan">未知</span>'
                    }
                },
                {field: 'mobilephone', title: '移动电话', sort: false, align: 'center'},
                {field: 'identity', title: '身份证', sort: false, align: 'center'},
                {field: 'email', title: '邮箱', sort: false, align: 'center'},
                {title: '操作', sort: false, align: 'center', toolbar: '#barDemo'}
            ];
            table.render(
                renderTable("#payPmList", 'admin/manager/info', data)
            );

            table.on('tool(payPmList)', function (obj) {
                var data = obj.data;
                if (obj.event === "msg") {
                    layer.open({
                        type: 2,
                        title: '',
                        shadeClose: true,
                        shade: 0.8,
                        area: ['95%', '95%'],
                        content: 'managerInfo/Detail?managerId='+data.managerId
                    });
                }
            });

            $("#search").click(function () {
                var adminName = $("#adminName").val(),
                    adminStatus = $("#adminStatus").val();

                table.reload('payPmList', {
                    page: {curr: 1},
                    where: {
                        adminName: adminName,
                        adminStatus: adminStatus
                    }
                })
            });
        });
    })

    $("#cancel").on("click", function () {
        layer.closeAll()
    });

    function hideFun() {
        layer.closeAll();
        adminId = null
    }

    function hideWithReset(hide, reset) {
        $(hide).hide()
        $(reset)[0].reset()
    }
</script>
</body>
</html>
